let get = require('../../utils/util')

Page({

  /**
   * 页面的初始数据
   */
  data: {
    url:getApp().globalData.domain,
    mulu:[],
    list:[],
    currentIndex:1
  },
  onLoad(){
    get("shop/category",{}).then(res=>{
      this.setData({
        mulu:res.data.data
      })
      this.setData({
        currentIndex :this.data.mulu[0].id
      })

      get("shop/commodity",{id:this.data.currentIndex}).then(res=>{
        this.setData({
          list:res.data.data
        })
      })
      
    })
  },

muluf(event){
  this.setData({
    currentIndex : event.currentTarget.id
  })
  get("shop/commodity",{id:this.data.currentIndex}).then(res=>{
    this.setData({
      list:res.data.data
    })
  })
}

})